home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-11-06 | 1.7 KB | 99 lines | [TEXT/MSET] |
- \ 28Oct94 dbh updated to 2.5 syntax
-
- (*
-
- Class terec is strictly intended for use as a way to conveniently access the
- Mac toolbox data structure for a TextEdit record. As can be seen in class te,
- as is shown in the example, we don't instantiate a terec object or ivar.
- Instead, we obtain a pointer to the record ( ptr: TEHandle, in this case)
- and then pass a message to the class itself!
-
- *)
-
-
- :class teRec super{ object }
- record{
- rect+ destRect
- rect+ viewRect
- rect+ selRect
- int lineHeight
- int fontAscent
- point selPoint
- int selStart
- int selEnd
- int active
- ptr wordBreak
- ptr clikLoop
- 12 bytes 1terec \ unmapped
- int just
- int teLength
- handle htext
- 6 bytes 2terec \ unmapped
- int crOnly
- int txFont
- int txFace
- int txMode
- int txSize
- ptr inPort \ the wptr
- 8 bytes 3terec \ unmapped
- int nlines
- 0 bytes lineStarts
- }
-
- :m setlineHeight: ( n -- )
- put: lineHeight ;m
-
- :m lineHeight: ( -- n )
- get: lineHeight ;m
-
- :m #lines: ( -- n )
- get: nlines ;m
-
- :m selStart: ( -- n )
- get: selStart ;m
-
- :m selEnd: ( -- n )
- get: selEnd ;m
-
- :m getselect: ( -- addr len ) \ returns hilited selection
- ptr: htext selstart: self + ( addr)
- selend: self selstart: self - ( len) ;m
-
- :m addrLineStart: ( -- addr)
- lineStarts ;m
-
- :m size: ( -- n )
- get: teLength ;m
-
- :m moveto: { l t -- }
- l t moveto: destRect
- l t moveto: viewRect ;m
-
- :m setview: ( l t r b -- )
- put: viewRect ;m
-
- :m setdest: ( l t r b -- )
- put: destRect ;m
-
- :m move: { dx dy -- }
- dx dy move: destRect
- dx dy move: viewRect ;m
-
- :m gettextaddr: ( -- addr )
- get: htext @ ;m
-
- :m noWrap:
- -1 put: crOnly ;m
-
- ;class
-
- endload
-
- *** EXAMPLE USE
-
- (from class te)
-
- :m setlineHeight: ( n -- )
- ptr: TEHandle setlineHeight: teRec ;m
-
-